`include "common_def.v" 
module MODULE_LS_REGS(
	input								clk_i,
	input								rst_i,
	output							LSRp_ready_o,
	input								ls_valid_i,
	input								last_write_pr_en_i,
	output							write_pr_en_o,
	input								wash_i,//delete

	input								wenR_i,
	input								is_load_i,
	input	[4:0]					addr_dst_i,
	input	[`WIDTH-1:0]	data_dst_i,
	input [`WIDTH-1:0]	load_data_i,
	input	[`WIDTH-1:0]	pc_i,//delete
	input								is_nouse_inst_i,//delete
	input								is_clint_i,//delete

	output								wenR_o,
	output								is_load_o,
	output	[4:0]					addr_dst_o,
	output	[`WIDTH-1:0]	data_dst_o,
	output	[`WIDTH-1:0]		pc_o,//delete
	output								is_nouse_inst_o,//delete
	output								is_clint_o,//delete
	output [`WIDTH-1:0]	load_data_o
);

//write_regs_en
wire write_regs_en;
wire write_regs_en =ls_valid_i ;
//assign write_pr_en_o = write_regs_en|pc_jump_o;
assign write_pr_en_o = write_regs_en;
//LSRp_ready_o 
wire LSRp_ready_r;
wire LSRp_ready;
assign LSRp_ready = ls_valid_i;
Reg #(1,1) LSRp_ready_o_reg(clk_i,rst_i, last_write_pr_en_i? 1'b0:LSRp_ready,LSRp_ready_r,LSRp_ready|last_write_pr_en_i);
assign LSRp_ready_o = LSRp_ready | LSRp_ready_r;


Reg #(1,0) reg_wenR_o(clk_i,rst_i,wenR_i,wenR_o,write_regs_en);
Reg #(1,0) reg_is_load_o(clk_i,rst_i,is_load_i,is_load_o,write_regs_en);
Reg #(5,0) reg_addr_dst_o(clk_i,rst_i,addr_dst_i,addr_dst_o,write_regs_en);
Reg #(`WIDTH,0) reg_data_dst_o(clk_i,rst_i,data_dst_i,data_dst_o,write_regs_en);
Reg #(`WIDTH,0) reg_load_data_o(clk_i,rst_i,load_data_i,load_data_o,write_regs_en);
Reg #(`WIDTH,0)	reg_pc_o(clk_i,rst_i,pc_i,pc_o,write_regs_en);//delete
Reg #(1,0)	reg_is_nouse_inst_o(clk_i,rst_i,wash_i ?0:is_nouse_inst_i,is_nouse_inst_o,write_regs_en|wash_i);//delete
Reg #(1,0) reg_is_clint_o(clk_i,rst_i,is_clint_i,is_clint_o,write_regs_en);//delete

//inst_cnt and clk cnt
wire [`WIDTH-1:0] inst_cnt;//delete
wire [`WIDTH-1:0] clk_cnt;//delete
Reg #(`WIDTH,0) inst_cnt_reg (clk_i,rst_i,inst_cnt+1,inst_cnt,write_pr_en_o&(~is_nouse_inst_i));//delete
Reg #(`WIDTH,0) clk_cnt_reg(clk_i,rst_i,clk_cnt+1,clk_cnt,1);//delete
wire [`WIDTH-1:0] cnt[2];//delete
assign cnt[0] = inst_cnt;//delete
assign cnt[1] = clk_cnt;//delete
import "DPI-C" function void set_cnt_ptr(input [`WIDTH-1:0] a[]);//delete
initial set_cnt_ptr(cnt);//delete
endmodule
